Method for setting universal serial bus (USB) interface of electronic device, and electronic device

ABSTRACT

A method includes processing a plurality of descriptors received from an electronic device. Each descriptor corresponds to a function of the electronic device. The processing includes determining a virtual function device corresponding to execution of at least one function based on a successful matching of one or more of the received descriptors with one or more driver files corresponding to at least one of the plurality of functions. The method also includes communicating an operating command to the virtual function device corresponding to execution of the at least one function based on an indication that the at least one function is to be executed. The operating command causes the virtual function device corresponding to execution of the at least one function to be operated on the electronic device. Two or more functions of the plurality of functions associated with different resources of the electronic device are selectable for execution.

CROSS-REFERENCE TO RELATED APPLICATIONS

This non-provisional application is a continuation of U.S. applicationSer. No. 15/819,022, filed Nov. 21, 2017, which is a continuationapplication of U.S. application Ser. No. 14/603,867, filed Jan. 23,2015, now U.S. Pat. No. 9,852,085, issued Dec. 26, 2017, which itselfclaims the priority to, under 35 U.S.C. § 119(a), Chinese PatentApplication No. 201410461865.8, filed on Sep. 11, 2014, in the StateIntellectual Property Office of P.R. China. The entire contents of theabove identified applications are incorporated herein by reference.

Some references, if any, which may include patents, patent applicationsand various publications, may be cited and discussed in the descriptionof this invention. The citation and/or discussion of such references, ifany, is provided merely to clarify the description of the presentinvention and is not an admission that any such reference is “prior art”to the invention described herein. All references listed, cited and/ordiscussed in this specification are incorporated herein by reference intheir entireties and to the same extent as if each reference wasindividually incorporated by reference.

FIELD OF THE INVENTION

The present disclosure relates to electronic technology, and moreparticularly, to methods of setting a universal serial bus (USB)interface of an electronic device.

BACKGROUND OF THE INVENTION

The background description provided herein is for the purpose ofgenerally presenting the context of the disclosure. Work of thepresently named inventors, to the extent it is described in thisbackground section, as well as aspects of the description that may nototherwise qualify as prior art at the time of filing, are neitherexpressly nor impliedly admitted as prior art against the presentdisclosure.

Currently, the group of users for Android smartphones is increasing. Ithas become an issue of concern for people as to how to allow users tooperate the Android smartphones more conveniently through PersonalComputers (PCs).

Due to the open nature of the Android system, more and more mobile phoneassistants for the PCs are available. The mobile phone assistants may beinstalled in the PCs to implement operations on mobile phones throughuniversal serial bus (USB) interfaces.

Therefore, a heretofore unaddressed need exists in the art to addressthe aforementioned deficiencies and inadequacies.

SUMMARY OF THE INVENTION

One aspect of the present disclosure relates to a method comprisingprocessing, by a controller, a plurality of descriptors received from anelectronic device communicatively coupled with the controller. Eachdescriptor of the plurality of descriptors corresponds to a function ofa plurality of functions of the electronic device. The processingcomprises determining a virtual function device corresponding toexecution of at least one function of the plurality of functions basedon a successful matching of one or more of the received descriptors withone or more driver files corresponding to at least one function of theplurality of functions. The method also comprises communicating anoperating command to the virtual function device corresponding toexecution of the at least one function based on an indication that theat least one function is to be executed. The operating command causesthe virtual function device corresponding to execution of the at leastone function to be operated on the electronic device. Two or morefunctions of the plurality of functions associated with differentresources of the electronic device are selectable for execution.

In certain exemplary embodiments, the method further includes: after thecontroller detects the USB interface being connected to the electronicdevice, sending, by the controller, a command of obtaining thedescriptors to the electronic device through the USB interface.

In certain exemplary embodiments, the method further includes: after thecontroller detects the USB interface being connected to the electronicdevice, determining, by the controller, that the electronic device is ina non-charging mode according to mode information received from theelectronic device.

Another aspect of the present disclosure relates to an apparatus,comprising a processor and a non-transitory computer readable mediumhaving computer-executable program code stored thereon that, whenexecuted by the processor, causes the apparatus to process a pluralityof descriptors received from an electronic device communicativelycoupled with the apparatus. Each descriptor of the plurality ofdescriptors corresponds to a function of a plurality of functions of theelectronic device. The processing comprises determining a virtualfunction device corresponding to execution of at least one function ofthe plurality of functions based on a successful matching of one or moreof the received descriptors with one or more driver files correspondingto at least one function of the plurality of functions. The apparatus isalso caused to communicate an operating command to the virtual functiondevice corresponding to execution of the at least one function based onan indication that the at least one function is to be executed. Theoperating command causes the virtual function device corresponding toexecution of the at least one function to be operated on the electronicdevice. Two or more functions of the plurality of functions associatedwith different resources of the electronic device are selectable forexecution.

In certain exemplary embodiments, the method further includes: after theelectronic device detects the connection to the apparatus through theUSB interface, determining, by the electronic device, corresponding modeinformation according to a mode selected by the user, and sending themode information determined to the apparatus, wherein the modeinformation is configured to indicate whether the electronic device isin a non-charging mode.

In certain exemplary embodiments, the description information includesat least one of the following information: device descriptioninformation, configuration description information, interfacedescription information, and endpoint description information.

A further aspect of the present disclosure relates to method comprisingdisplaying, by an electronic device, a plurality of functions of theelectronic device. The displaying is based on a determination that theelectronic device is communicatively coupled with a controller. At leastone function of the plurality of functions corresponds to one virtualinterface of a plurality of virtual interfaces. A first function and asecond function of the plurality of functions are associated with afirst resource of the electronic device. A third function of theplurality of functions is associated with a second resource of theelectronic device different from the first resource. The method alsocomprises communicating a plurality of descriptors to the controller,wherein each descriptor of the plurality of descriptors corresponds to afunction of the plurality of functions of the electronic device. Themethod further comprises identifying at least one of the first functionor the second function is to be executed based on a first indication.The method additionally comprises identifying the third function to beexecuted based on a second indication different from the firstindication.

In certain exemplary embodiments, the first function is a media transferprotocol (MTP) function, the second function is a picture transferprotocol (PTP) function, and the third function is an AndroidDevelopment Bridge (ADB) function.

These and other aspects of the disclosure will become apparent from thefollowing description of several exemplary embodiments taken inconjunction with the following drawings, although variations andmodifications therein may be effected without departing from the spiritand scope of the novel concepts of the disclosure.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings illustrate one or more embodiments of thedisclosure and together with the written description, serve to explainthe principles of the disclosure. Wherever possible, the same referencenumbers are used throughout the drawings to refer to the same or likeelements of an embodiment.

FIG. 1 shows a flowchart of a method for operating a first electronicdevice according to one exemplary embodiment of the present disclosure.

FIG. 2 shows a flowchart of a method for setting a USB interfaceaccording to one exemplary embodiment of the present disclosure.

FIG. 3 shows a flowchart of a method for operating a first electronicdevice according to one exemplary embodiment of the present disclosure.

FIG. 4 schematically shows an apparatus for operating a first electronicdevice according to one exemplary embodiment of the present disclosure.

FIG. 5 schematically shows an apparatus for setting a USB interfaceaccording to one exemplary embodiment of the present disclosure.

FIG. 6 schematically shows an electronic device according to oneexemplary embodiment of the present disclosure.

DETAILED DESCRIPTION OF THE INVENTION

The disclosure will now be described hereinafter with reference to theaccompanying drawings, in which several exemplary embodiments of thedisclosure are shown. This disclosure may, however, be embodied in manydifferent forms and should not be construed as limited to the exemplaryembodiments set forth herein.

The terms used in this specification generally have their ordinarymeanings in the art, within the context of the disclosure, and in thecontext where each term is used. Certain terms that are configured todescribe the disclosure are discussed below, or elsewhere in thespecification, to provide additional guidance to the practitionerregarding the description of the disclosure. For convenience, certainterms may be highlighted, for example using italics and/or quotationmarks. The use of highlighting has no influence on the scope and meaningof a term; the scope and meaning of a term is the same, in the samecontext, whether or not it is highlighted. It will be appreciated thatsame thing can be said in more than one way. Consequently, alternativelanguage and synonyms may be used for any one or more of the termsdiscussed herein, nor is any special significance to be placed uponwhether or not a term is elaborated or discussed herein. Synonyms forcertain terms are provided. A recital of one or more synonyms does notexclude the use of other synonyms. The use of examples anywhere in thisspecification including examples of any terms discussed herein isillustrative only, and in no way limits the scope and meaning of thedisclosure or of any exemplified term. Likewise, the disclosure is notlimited to various exemplary embodiments given in this specification.

It will be understood that, although the terms first, second, third etc.may be used herein to describe various elements, components, regions,layers and/or sections, these elements, components, regions, layersand/or sections should not be limited by these terms. These terms areonly configured to distinguish one element, component, region, layer orsection from another element, component, region, layer or section. Thus,a first element, component, region, layer or section discussed belowcould be termed a second element, component, region, layer or sectionwithout departing from the teachings of the disclosure.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the disclosure.As used herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising”, or “includes” and/or “including” or “has” and/or“having” when used in this specification, specify the presence of statedfeatures, regions, integers, steps, operations, elements, and/orcomponents, but do not preclude the presence or addition of one or moreother features, regions, integers, steps, operations, elements,components, and/or groups thereof.

Unless otherwise defined, all terms (including technical and scientificterms) used herein have the same meaning as commonly understood by oneof ordinary skill in the art to which this disclosure belongs. It willbe further understood that terms, such as those defined in commonly useddictionaries, should be interpreted as having a meaning that isconsistent with their meaning in the context of the relevant art and thedisclosure, and will not be interpreted in an idealized or overly formalsense unless expressly so defined herein.

As used herein, “around”, “about” or “approximately” shall generallymean within 20 percent, preferably within 10 percent, and morepreferably within 5 percent of a given value or range. Numericalquantities given herein are approximate, meaning that the term “around”,“about” or “approximately” can be inferred if not expressly stated.

As used herein, the terms “comprising,” “including,” “having,”“containing,” “involving,” and the like are to be understood to beopen-ended, i.e., to mean including but not limited to.

The description will be made as to the exemplary embodiments of thedisclosure in conjunction with the accompanying drawings in FIGS. 1-6.It should be understood that exemplary embodiments described herein aremerely used for explaining the disclosure, but are not intended to limitthe disclosure. In accordance with the purposes of this disclosure, asembodied and broadly described herein, this disclosure, in certainaspects, relates to a beam shaping apparatus, a method of light beamshaping, and a reflector unit.

In one exemplary embodiment of the present disclosure, a control devicedetects a USB interface being connected to a first electronic device,where the USB interface of the first electronic device has a pluralityof virtual ports. Then the control device receives descriptioninformation corresponding to functions of the first electronic devicethrough the USB interface. Then the control device matches each of thedescription information corresponding to each of the functions with oneof a plurality of driver files corresponding to each of the functions,and after the matching is successful, determines a virtual functiondevice corresponding to execution of each of the functions. Finally, inresponse to receiving an operating command for executing one of thefunctions, the control device sends the operating command to thecorresponding virtual function device to the function to be executedthrough a driver interface corresponding to the function to be executed,such that the corresponding virtual function device to the function tobe executed is operated on the electronic device.

In one exemplary embodiment of the present disclosure, after the firstelectronic device is connected to the control device through the USBinterface, the first electronic device receives a command of obtainingdescription information sent by the control device. After receiving thecommand of obtaining the description information sent by the controldevice, the first electronic device displays a plurality of functionseach corresponding to one of a plurality of virtual ports. Then thefirst electronic device generates corresponding description informationaccording to a corresponding USB driver to each of the functionsselected by a user. Then, the first electronic device sends thegenerated description information to the control device through the USBinterface.

In certain exemplary embodiments, due to increasing the virtual ports ofthe USB interface of the first electronic device in such a technicalsolution, the control device may obtain description informationcorresponding to at least one function, allowing implementation for thecontrol device to operate at least one function of peripheral devices.

In one exemplary embodiment of the present disclosure, the firstelectronic device may be a mobile phone, a tablet computer, an e-bookreader, an MP4 player, or the like. The control device may be a PC orthe like. The description information may be a descriptor.

The exemplary embodiments of the present disclosure may be furtherdescribed below in detail with reference to the accompanying drawings ofthe specification.

FIG. 1 shows a flowchart of a method for operating a first electronicdevice according to one exemplary embodiment of the present disclosure.As shown in FIG. 1, the method includes:

Operation 100: A control device detects a USB interface being connectedto the first electronic device, where the USB interface of the firstelectronic device has a plurality of virtual ports.

Operation 101: The control device receives descriptors corresponding tofunctions of the first electronic device through the USB interface.

Operation 102: The control device matches each of the descriptorscorresponding to each of the functions with one of a plurality of driverfiles corresponding to each of the functions, and after the matching issuccessful, determines a virtual function device corresponding toexecution of each of the functions.

Operation 103: In response to receiving an operating command ofexecuting one of the functions, the control device sends the operatingcommand to the corresponding virtual function device to the function tobe executed through a driver interface corresponding to the function tobe executed, such that the corresponding virtual function device to thefunction to be executed is operated on the electronic device.

In certain exemplary embodiments, the control device may be a devicehaving a control function, such as a PC, and the first electronic devicemay be a smartphone or other smart devices having an operating system,such as an Android system.

In certain exemplary embodiments, the control device, after detectingthe USB interface being connected to the first electronic device andbefore receiving at least one of the descriptors corresponding to atleast one of the functions of the first electronic device through theUSB interface, may further send a command of obtaining the descriptorsto the first electronic device through the USB interface, such that thefirst electronic device may return the descriptors. The process ofsending the command and receiving the descriptors may also be referredto as an enumeration process.

In one exemplary embodiment of the present invention, the USBdescriptors may include one or more of a device descriptor, aconfiguration descriptor, an interface descriptor and an endpointdescriptor, which are respectively used for reporting USB deviceinformation, configuration information, interface information andendpoint information.

In one possible case, one exemplary embodiment of a descriptor isreported by a USB device to a PC when the PC enumerates the USB device.With the information included in the descriptor, the PC may understandthe number of interfaces the USB device has, the number of correspondingfunctions the USB device provides, and the endpoint each of theinterfaces utilizes. In this case, a PC driver can communicate with theUSB device. Several examples of specific content of the devicedescriptor, the configuration descriptor, the interface descriptor andthe endpoint descriptor are described below, which should not beconstrued to limit the present invention:

Device Descriptor

12 01 00 02 00 00 00 40 9B 10 30 91 FF FF 01 02 . . . @ . . . 0 . . .

03 01

bLength 0x12

bDescriptorType 0x01

bcdUSB 0x0200—Spec#=02.00

bDeviceClass 0x00—(Defined at Interface level)

bDeviceSubClass 0x00

bDeviceProtocol 0x00

bMaxPacketSize0 0x40—64 bytes

idVendor 0x109B

idProduct 0x9130

bcdDevice 0xFFFF—Device#=FF.FF

iManufacturer 0x01—Hisense

iProduct 0x02—Hisense

iSerialNumber 0x03—I632M

bNumConfigurations 0x01

Configuration Descriptor:

09 02 3E 00 02 01 00 80 FA . . . > . . .

bLength 0x09

bDescriptorType 0x02

wTotalLength 0x003E

bNumInterfaces 0x02

bConfigurationValue 0x01

iConfiguration 0x00

bmAttributes 0x80—Self-powered=No, Remote Wakeup=No

MaxPower 0xFA—500 mA

Interface Descriptor:

09 04 00 00 03 FF FF 00 05

bLength 0x09

bDescriptorType 0x04

bInterfaceNumber 0x00

bAlternateSetting 0x00

bNumEndpoints 0x03

bInterfaceClass 0xFF—Vendor specific

bInterfaceSubClass 0xFF—Vendor specific

bInterfaceProtocol 0x00—Vendor specific

iInterface 0x05—MTP

Endpoint Descriptor:

07 05 81 02 00 02 00

bLength 0x07

bDescriptorType 0x05

bEndpointAddress 0x81—Endpoint#=1, Direction=IN

bmAttributes 0x02—Transfer Type=Bulk

wMaxPacketSize 0x0200—512 bytes

bInterval 0x00—Ignored

Endpoint Descriptor:

07 05 01 02 00 02 00

bLength 0x07

bDescriptorType 0x05

bEndpointAddress 0x01—Endpoint#=1, Direction=OUT

bmAttributes 0x02—Transfer Type=Bulk

wMaxPacketSize 0x0200—512 bytes

bInterval 0x00—Ignored

Endpoint Descriptor:

07 05 82 03 1C 00 06

bLength 0x07

bDescriptorType 0x05

bEndpointAddress 0x82—Endpoint#=2, Direction=IN

bmAttributes 0x03—Transfer Type=Interrupt

wMaxPacketSize 0x001C—28 bytes

bInterval 0x06—6 milliseconds

Interface Descriptor:

09 04 01 00 02FF 42 01 04 . . . B . . .

bLength 0x09

bDescriptorType 0x04

bInterfaceNumber 0x01

bAlternateSetting 0x00

bNumEndpoints 0x02

bInterfaceClass 0xFF—Vendor specific

bInterfaceSubClass 0x42—Vendor specific

bInterfaceProtocol 0x01—Vendor specific

iInterface 0x04—ADB Interface

Endpoint Descriptor:

07 05 02 02 00 02 00

bLength 0x07

bDescriptorType 0x05

bEndpointAddress 0x02—Endpoint#=2, Direction=OUT

bmAttributes 0x02—Transfer Type=Bulk

wMaxPacketSize 0x0200—512 bytes

bInterval 0x00—Ignored

Endpoint Descriptor:

07 05 83 02 00 02 00

bLength 0x07

bDescriptorType 0x05

bEndpointAddress 0x83—Endpoint#=3, Direction=IN

bmAttributes 0x02—Transfer Type=Bulk

wMaxPacketSize 0x0200—512 bytes

bInterval 0x00—Ignored

In certain exemplary embodiments of the present disclosure, after thecontrol device is connected to the first electronic device through theUSB interface, an unknown virtual function device is displayed on thecontrol device, and a message box is popped up on the first electronicdevice, such that a user may select the functions thereof in the messagebox according to needs. In certain exemplary embodiments, the selectedfunctions cannot occupy the same mobile phone resource. For example, themedia transfer protocol (MTP) and the picture transfer protocol (PTP)cannot be selected at the same time since MTP and PTP occupy the samestorage resource of the first electronic device, and thus operationscannot be performed thereon simultaneously.

After selection of the functions, the control device performs theenumeration process. In other words, that is, the control deviceperforms the process to send a command of obtaining the descriptors, andthereby obtaining the descriptors corresponding to the functionsselected by the user.

In one exemplary embodiment of the present disclosure, with respect toone of the functions, a corresponding descriptor may include some or allof the following information: a device descriptor, a configurationdescriptor, an interface descriptor and an endpoint descriptor.

After obtaining the descriptors corresponding to the functions selectedby the user, the descriptor information corresponding to the functionswill be matched with corresponding function driver files of the controldevice. For example, if MTP and Android Development Bridge (ADB) areselected, the descriptor information of the MTP function is matched withan MTP driver file of the control device, and the descriptor informationof the ADB function is matched with an ADB driver file of the controldevice. Specifically, the matching process may be described using theADB function as an example. After the descriptor information of the ADBfunction is obtained, the control device selects configurationinformation corresponding to the function in an ADB driver file, andmatches the selected configuration information with the obtaineddescriptor information. If the matching is successful, one of aplurality of unknown virtual function devices displayed on the controldevice is selected, and the selected unknown virtual function device isconfigured according to the selected configuration information through aset configuration request, such that the configured virtual functiondevice is taken as a virtual function device corresponding to executionof the function.

After a corresponding operating command is received, the operatingcommand is delivered to a corresponding virtual drive device through acorresponding driver interface, thereby implementing the operation onthe mobile phone, for example, a delete operation is performed on avideo of the first electronic device through the MTP function, and whenthe control device receives an operating command of deleting a relatedvideo, the command is delivered to an MTP driver interface and then isdelivered to an MTP device through the MTP driver interface, therebyimplementing the operation of deleting a video from the first electronicdevice. In one exemplary embodiment of the present disclosure, while thefirst electronic device is operated through the MTP function, the firstelectronic device can also be operated by using the ADB function oranother function that does not occupy the same resource of the firstelectronic device with the MTP function.

In one exemplary embodiment of the present disclosure, after detectingthe USB interface being connected to the first electronic device, thecontrol device sends a command of obtaining the descriptors to the firstelectronic device through the USB interface. Further, after sending thecommand of obtaining the descriptors to the first electronic device, thecontrol device receives the descriptors corresponding to at least one ofthe functions of the first electronic device through the USB interface.

In certain exemplary embodiments of the present disclosure, the commandof obtaining the descriptors may be an existing command of getting onedescriptor. However, in certain exemplary embodiments, there may bemultiple descriptors, and the command may also be a new command.

For example, the control device may send a get device descriptorstandard request to the first electronic device through an address 0 inorder to obtain a device descriptor. Then the control device may send aget configuration request to the first electronic device in order toobtain a configuration descriptor.

After the control device is connected to the first electronic devicethrough the USB interface, a message box may pop up on the firstelectronic device to require the user to select a function mode thereof.If the user selects a charging mode, it indicates that the user onlyrequires charging of the first electronic device without the need tooperate the first electronic device. In this case, the control devicedoes not perform the enumeration process again. Alternatively, thecontrol device needs to perform the enumeration process.

Therefore, the control device, after detecting the USB interface beingconnected to the first electronic device, may determine whether thefirst electronic device is in a non-charging mode. If the control devicedetermines that the first electronic device is in the non-charging mode,the control device receives the descriptors corresponding to at leastone of the functions of the first electronic device through the USBinterface. In other words, when a function such as MTP, ADB or PTP isselected through the message box popped up at the first electronicdevice, such as a mobile phone, which is in the non-charging mode, thecontrol device needs to perform the enumeration process. Thus, it isnecessary to determine the selection mode of the first electronic deviceprior to the enumeration process.

In one exemplary embodiment of the present disclosure, the methodfurther includes: after the control device detects the USB interfacebeing connected to the first electronic device, if the control devicedetermines that the first electronic device is in a charging modeaccording to the mode information received from the first electronicdevice, the control device skips the operation of receiving thedescriptors corresponding to the functions of the first electronicdevice through the USB interface to directly perform a chargingoperation on the first electronic device.

If a charging mode is selected, the PC will directly charge the mobilephone, and skip the process that the control device receives thedescriptors corresponding to the functions of the first electronicdevice through the USB interface, the subsequent processes of matchingthe descriptors corresponding to the functions with the driver filescorresponding to the functions and determining a virtual functiondevice, and the process of operating one or more functions of the firstelectronic device. Thus, the purpose of allowing the user to perform acharging operation on the mobile phone through the PC without installinga driver thereon may be achieved.

FIG. 2 shows a flowchart of a method for setting a USB interfaceaccording to one exemplary embodiment of the present disclosure. Asshown in FIG. 2, the method includes:

Operation 200: A first electronic device detects a connection with acontrol device through a USB interface.

Operation 201: The first electronic device receives a command ofobtaining descriptors sent by the control device.

Operation 202: After receiving the command of obtaining descriptors sentby the control device, the first electronic device displays a pluralityof functions each corresponding to one virtual port of a plurality ofvirtual ports.

Operation 203: The first electronic device generates each of thecorresponding descriptors according to a corresponding USB driver toeach of the functions selected by a user.

Operation 204: The first electronic device sends the generateddescriptors to the control device through the USB interface.

In certain exemplary embodiments of the present disclosure, in a USBdevice, a virtual port interface is taken as a unit thereof. Thus,different functions correspond to different interfaces, where thedifferent functions cannot occupy the same resource of a mobile phone.Thus, an operation of selecting at least one of functions in a messagebar of the mobile phone may be implemented. For example, MTP maycorrespond to interface 0, and ADB may correspond to interface 1, suchthat the user may select both MTP and ADB functions at the same time orjust one of them.

In one exemplary embodiment of the present disclosure, after the firstelectronic device detects the connection with the control device throughthe USB interface, the method further includes: the first electronicdevice determines corresponding mode information according to a modeselected by a user, and sends the determined mode information to thecontrol device, where the mode information is configured to indicatewhether the first electronic device is in a non-charging mode.

FIG. 3 shows a flowchart of a method for operating a first electronicdevice according to one exemplary embodiment of the present disclosure.As shown in FIG. 3, the method includes:

Operation 300: In a USB device, configuring different functions, whichdo not occupy the same resource of the first electronic device, tocorrespond to different interfaces.

Operation 301: Connecting the first electronic device to a controldevice through a USB interface, pop up a message bar on the firstelectronic device, and a user makes a selection according torequirements.

Operation 302: Determining whether a charging mode is selected in themessage bar of the first electronic device. If so, the control deviceperforms Operation 303; otherwise, the control device performs Operation304.

Operation 303: The control device skips the enumeration process anddirectly charges the first electronic device; and the process ends.

Operation 304: If MTP and ADB functions are selected in the message barof the first electronic device, the control device performs theenumeration process to obtain descriptors corresponding to MTP and ADB.

Operation 305: Matching the descriptor of the MTP and the descriptor ofthe ADB respectively with a corresponding MTP driver file and acorresponding ADB driver file on the control device.

Operation 306: If the matching is successful, after the control deviceis connected to the first electronic device through the USB interface,determining unknown devices displayed on the control device to be an MTPdevice and an ADB device.

Operation 307: The control device, after receiving a correspondingoperating command, sends the operating command to a corresponding driverdevice through a corresponding driver interface, thereby implementing anoperation on a mobile phone.

One exemplary embodiment of the present disclosure further provides anapparatus for operating a first electronic device. As the methodcorresponding to the apparatus for operating the first electronic deviceis the method for operating the first electronic device, the apparatusmay be implemented with reference to the method as described above, andis thus not elaborated herein.

FIG. 4 schematically shows an apparatus for operating a first electronicdevice according to one exemplary embodiment of the present disclosure.As shown in FIG. 4, the apparatus for operating the first electronicdevice includes:

a first detection module 400, configured to detect a USB interface beingconnected to the first electronic device, where the USB interface of thefirst electronic device has a plurality of virtual ports;

a first receiving module 401, configured to receive descriptorscorresponding to functions of the first electronic device through theUSB interface;

a matching module 402, configured to match each of the descriptorscorresponding to each of the functions with one of the driver filescorresponding to each of the functions, and after the matching issuccessful, determining a virtual function device corresponding toexecution of each of the functions; and

an execution module 403, configured to, in response to receiving anoperating command of executing one of the functions, sending theoperating command to a virtual function device corresponding to afunction to be executed through a driver interface corresponding to thefunction to be executed, such that the corresponding virtual functiondevice to the function to be executed is operated on the electronicdevice.

In one exemplary embodiment of the present disclosure, the firstdetection module 400 is further configured to, after detecting the USBinterface being connected to the first electronic device, send a commandof obtaining the descriptors to the first electronic device through theUSB interface.

In one exemplary embodiment of the present disclosure, with respect toone of the functions, a corresponding descriptor may include some or allof the following information: a device descriptor, a configurationdescriptor, an interface descriptor and an endpoint descriptor.

In one exemplary embodiment of the present disclosure, the firstreceiving module 401 is further configured to, after detecting the USBinterface being connected to the first electronic device, receive thedescriptors corresponding to the functions of peripheral devices throughthe USB interface if the first electronic device is determined to be ina non-charging mode.

In one exemplary embodiment of the present disclosure, the firstreceiving module 401 is further configured to, after detecting the USBinterface being connected to the first electronic device, if the firstelectronic device is determined to be in a charging mode according tomode information received from the first electronic device, skip theoperation of receiving the descriptors corresponding to the functions ofthe first electronic device through the USB interface, and directlyperform a charging operation on the first electronic device.

FIG. 5 schematically shows an apparatus for setting a USB interfaceaccording to one exemplary embodiment of the present disclosure. Asshown in FIG. 5, the apparatus for setting the USB interface includes:

a second detection module 500, configured to detect a connection with acontrol device through a USB interface;

a second receiving module 501, configured to receive a command ofobtaining descriptors sent by the control device;

a display module 502, configured to, after receiving the command ofobtaining the descriptors sent by the control device, display aplurality of functions each corresponding to one virtual port of aplurality of virtual ports;

a generation module 503, configured to generate a correspondingdescriptor according to a USB driver corresponding to each of thefunctions selected by a user; and

a sending module 504, configured to send the generated descriptors tothe control device through the USB interface.

In one exemplary embodiment of the present disclosure, the secondreceiving module 501 is further configured to, after the firstelectronic device detects the connection with the control device throughthe USB interface, determine corresponding mode information according toa mode selected by the user, and send the determined mode information tothe control device, where the mode information is configured to indicatewhether the first electronic device is in a non-charging mode.

FIG. 6 schematically shows an electronic device according to oneexemplary embodiment of the present disclosure. As shown in FIG. 6, theelectronic device 6000 may be various handheld devices (e.g., forexample, a mobile phone, a tablet computer, a personal digital assistant(PDA), and the like), which may include a processor having one or moreprocessing cores, a radio frequency (RF) circuit, a memory including oneor more non-transitory computer-readable storage media, an input device,a display device, a sensor, an audio frequency circuit, a WiFi module, apower supply and other components. A person skilled in the art mayunderstand that the structure of the structure of the electronic device6000 as shown in this exemplary embodiment does not constitute anylimitation. In certain exemplary embodiments, the electronic device 6000may include more or less components, or some components may be combined,or the components may be arranged differently.

The RF circuit may be used for is used for receiving and sending signalswhen information is received and sent or during a call process.Specifically, downlink information of a base station is processed by oneor more processors for processing after being received. In addition,uplink data may be sent to the base station. Usually, the RF circuitincludes, but is not limited to, an antenna, at least one amplifier, atuner, one or more oscillators, a subscriber identity module (SIM) card,a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, andthe like. Further, the radio frequency circuit may communicate withother devices through radio communications and networks. The radiocommunications may use any communications standard or protocol,including but not limited to Global System for Mobile Communication(GSM), General Packet Radio Service (GPRS), Code Division MultipleAccess (CDMA), Wideband Code Division Multiple Access (WCDMA), Long TermEvolution (LTE), an e-mail, a short message service (SMS), and the like.

The memory may be used to store one or more software programs andmodules. The processor may be used to run the software programs andmodules stored in the memory, thus performing execution of theapplications with various functions and processing data. In certainexemplary embodiments, the memory may mainly include a program storagearea and a data storage area, where the program storage area may storean operating system, an application (for example, sound playingfunction, image display function, and the like) that is needed by atleast one function, and the like; and the data storage area may storedata (for example, audio data, phone book, and the like) createdaccording to the use of the electronic device 6000. In addition, thememory may include a high-speed random access memory (RAM), and mayfurther include a nonvolatile memory, for example, at least one diskstorage device, a flash memory, or other volatile solid-state storagedevices. Correspondingly, the memory may also include a memorycontroller to control access to the memory by the processor and theinput device.

The input device may be used for receiving input digital or characterinformation, and generating input signals that may be related to usersettings and function control, such as a keyboard input signal, a mouseinput signal, a joystick input signal, an optic input signal, or atrackball input signal. Specifically, the input device may include atouch-sensitive surface, and other input devices. The touch-sensitivesurface, also referred to as a touch screen or a touchpad, may collecttouch operations performed by a user on or near the touch-sensitivesurface (for example, operations performed on or near thetouch-sensitive surface by a user using any proper object or accessory,such as a finger, a stylus, and the like), and drive a correspondingconnected apparatus according to a preset program. Optionally, thetouch-sensitive surface may include two parts, including a touchdetection apparatus and a touch controller. The touch detectionapparatus is configured to detect a location of a touch performed by auser, to generate a signal caused by the touch operation, and totransmit the signal to the touch controller. The touch controller isconfigured to receive touch information in the signal from the touchdetection apparatus, to convert the touch information into a touch pointcoordinate, and to send the touch point coordinate to the processor. Thetouch controller may also receive and execute a command sent by theprocessor. In addition, the touch-sensitive surface may be implementedin multiple types, such as a resistive type, a capacitive type, aninfrared type, and a surface acoustic wave type. In addition to thetouch-sensitive surface, the input device may further include otherinput devices. Specifically, the other input devices may include,without being not limited to, one or more of a physical keyboard, afunction key (for example, a volume control key, an on/off key, and thelike), a trackball, a mouse, and a joystick.

The display device may be used for displaying information input by theuser or information provided for the user, and various graphic userinterfaces of the electronic device 6000. These graphic user interfacesmay be formed by images, texts, icons, videos, and any combinationthereof. The display device may include a display panel. Optionally, thedisplay panel may be configured by using a liquid crystal display (LCD),an organic light-emitting diode (OLED), and the like. Further, thetouch-sensitive surface may cover the display panel, and after detectinga touch operation on or near the touch-sensitive surface, thetouch-sensitive surface may send a touch event to the processor so thatthe processor determines the type of the touch event. Then, theprocessor provides a corresponding display output on the display panelaccording to the type of the touch event. In certain exemplaryembodiments, the touch-sensitive surface and the display panel areconfigured to respectively implement the input and output functions astwo independent components. Alternatively, in certain exemplaryembodiments, the touch-sensitive surface and the display panel may beintegrated as one component to implement the input and output functions.

The electronic device 6000 may further include at least one sensor, forexample, an optical sensor, a motion sensor, and other sensors.Specifically, the optical sensor may include an ambient light sensor anda proximity sensor, where the ambient light sensor may adjust thebrightness of the display panel according to the luminance of theambient light, and the proximity sensor may turn off the display paneland/or a backlight when the electronic device 6000 is moved to the ear.A gravitational acceleration sensor, which is one type of the motionsensors, may detect the magnitude of an acceleration in each direction(usually in three axes), and may detect the magnitude and direction ofthe gravity in a static state. Thus, it may be used for an applicationrecognizing an attitude of a mobile phone (for example,landscape/portrait switch, a related game, and magnetometer attitudecalibration), and vibration identification related functions (forexample, pedometer and knock), and the like. The electronic device 6000may include other types of sensors, such as a gyroscope, a barometer, ahygrometer, a thermometer, and an infrared sensor, which are notelaborated herein.

The audio frequency circuit, a loudspeaker, and a microphone may providean audio interface between the user and the electronic device 6000. Theaudio frequency circuit may transmit an electrical signal converted fromreceived audio data to the loudspeaker, and the loudspeaker converts theelectrical signal into a sound signal and outputs the sound signal. Onthe other hand, the microphone converts a collected sound signal into anelectrical signal, and the audio frequency circuit receives and convertsthe electrical signal into audio data. After the audio data is sent toand processed by the processor, the processed audio data is sent by theradio frequency circuit to, for example, another apparatus, or is outputto the memory for further processing. The audio frequency circuit mayfurther include an earplug jack to provide communications between aperipheral earphone and the electronic device 6000.

WiFi belongs to a short-distance radio transmission technology. By meansof the WiFi module, the electronic device 6000 may assist a user toreceive or send an e-mail, browse a webpage, access streaming media, andthe like. The WiFi module provides a wireless broadband internet accessfor the user. Although the WiFi module is provided in this exemplaryembodiment, it can be understood that the WiFi module is not a mandatorycomponent of the mobile terminal device 11, and may be omitted based onthe need without changing the essence of the present disclosure.

The processor is a control component of the electronic device 6000,which is connected to all other components through various interfacesand circuits. The processor is configured to run or execute the softwareprograms and/or modules stored in the memory and to retrieve the datastored in the memory to perform execution of various functions and dataprocessing, so as to perform overall monitoring of the mobile phone.Optionally, the processor may include one or more processing cores. Incertain exemplary embodiments, the processor integrates an applicationprocessor and a modem processor, where the application processor mainlyprocesses an operating system, a user interface, an application, and thelike, and the modem processor mainly processes radio communication. Itcan be understood that the modem processor may not necessarily beintegrated in the processor.

The electronic device 6000 further includes a power supply (for example,a battery) to provide power to each component. In certain exemplaryembodiments, the power supply may be logically connected to theprocessor through a power supply management system, so that functionssuch as charging, discharging, and power management are implemented bythe power supply management system. The power supply may further includeany other component such as one or more direct current or alternatingcurrent power supplies, a recharging system, a power supply faultdetection circuit, a power supply converter or inverter, and a powerstatus indicator.

Although not explicitly shown, the electronic device 6000 may furtherinclude a camera, a Bluetooth module, and the like, which is notelaborated herein. Specifically, in this exemplary embodiment, thedisplay device of the electronic device 6000 is a touch screen display,and the electronic device 6000 further includes a memory, and one ormore programs, where the one or more programs are stored in the memory,and are configured to be executed by one or more processors.

As described above, in certain exemplary embodiments of the presentdisclosure, a control device detects that a USB interface is connectedto a first electronic device, where the USB interface of the firstelectronic device has a plurality of virtual ports. Then the controldevice receives descriptors corresponding to functions of the firstelectronic device through the USB interface. Then the control devicematches each of the descriptors corresponding to each of the functionswith one of a plurality of driver files corresponding to each of thefunctions, and after the matching is successful, determines a virtualfunction device corresponding to execution of each of the functions. Inresponse to receiving an operating command for executing one of thefunctions, the control device sends the operating command to thecorresponding virtual function device to the function to be executedthrough a driver interface corresponding to the function to be executed,such that the corresponding virtual function device to the function tobe executed is operated on the electronic device.

In one exemplary embodiment of the present disclosure, after the firstelectronic device is connected to the control device through the USBinterface, the first electronic device receives a command of obtainingdescriptors sent by the control device. After receiving the command ofobtaining the descriptors sent by the control device, the firstelectronic device displays a plurality of functions each correspondingto one of a plurality of virtual ports. Then the first electronic devicegenerates each of the corresponding descriptors according to acorresponding USB driver to each of the functions selected by a user.Then the first electronic device sends the generated descriptors to thecontrol device through the USB interface.

In certain exemplary embodiments, due to increasing the virtual ports ofthe USB interface of the first electronic device in such a technicalsolution, the control device may obtain descriptors corresponding to atleast one function, allowing implementation for the control device tooperate at least one function of peripheral devices, thereby solving theproblem in which a PC may operate only one function of a mobile phonethrough a USB interface.

A person skilled in the art may understand that, the exemplaryembodiments of the present disclosure may be implemented as methods,systems or computer program products. Therefore, the present disclosuremay be implemented in different embodiments to be in the form of entirehardware, entire software and/or a combination of software and hardwarecomponents. Moreover, the present disclosure may be implemented in theform of computer program products stored in one or more computeravailable storage media (including, but not limited to, a disk memory, aCD-ROM, an optical memory, etc.), which includes computer executableprogram codes.

The present disclosure has been described with reference to theflowcharts and/or block diagrams of the methods, the devices (systems)and the computer program products according to the exemplaryembodiments. It should be understood that each process and/or block inthe flowcharts and/or the block diagrams, and a combination of processesand/or blocks in the flowcharts and/or the block diagrams, may beimplemented by computer program instructions. The computer programinstructions may be provided to a processor of a general-purposecomputer, a special-purpose computer, an embedded processor or otherprogrammable data processing devices to produce a machine, so as togenerate an apparatus used for implementing functions specified in oneor more processes of the flowcharts and/or one or more blocks in theblock diagrams through instructions executed by the processor of acomputer or other programmable data processing devices.

The computer program instructions may also be stored in a non-transitorycomputer-readable memory which can direct the computer or otherprogrammable data processing devices to operate in a particular manner,such that the instructions stored in the non-transitorycomputer-readable memory produce an article of manufacture includinginstruction means, where the instruction means implements functionsspecified in one or more processes of the flowcharts and/or one or moreblocks in the block diagrams.

The computer program instructions may also be loaded onto the computeror other programmable data processing devices, so as to execute a seriesof operations on the computer or other programmable devices to generateprocessing implemented by the computer, so that the instructionsexecuted on the computer or other programmable devices provideoperations for implementing functions specified in one or more processesof the flowcharts and/or one or more blocks in the block diagrams.

The foregoing description of the exemplary embodiments of the disclosurehas been presented only for the purposes of illustration and descriptionand is not intended to be exhaustive or to limit the disclosure to theprecise forms disclosed. Many modifications and variations are possiblein light of the above teaching.

The exemplary embodiments were chosen and described in order to explainthe principles of the disclosure and their practical application so asto activate others skilled in the art to utilize the disclosure andvarious exemplary embodiments and with various modifications as aresuited to the particular use contemplated. Alternative embodiments willbecome apparent to those skilled in the art to which the disclosurepertains without departing from its spirit and scope. Accordingly, thescope of the disclosure is defined by the appended claims rather thanthe foregoing description and the exemplary embodiments describedtherein.

What is claimed is:
 1. A method, comprising: processing, by acontroller, a plurality of descriptors received from an electronicdevice communicatively coupled with the controller, wherein eachdescriptor of the plurality of descriptors corresponds to a function ofa plurality of functions of the electronic device, and the processingcomprises: determining a virtual function device corresponding toexecution of at least one function of the plurality of functions basedon a successful matching of one or more of the received descriptors withone or more driver files corresponding to at least one function of theplurality of functions; and communicating an operating command to thevirtual function device corresponding to execution of the at least onefunction based on an indication that the at least one function is to beexecuted, wherein the operating command causes the virtual functiondevice corresponding to execution of the at least one function to beoperated on the electronic device, two or more functions of theplurality of functions associated with different resources of theelectronic device are selectable for execution, a first function and asecond function of the plurality of functions are associated with afirst resource of the electronic device, a third function of theplurality of functions is associated with a second resource of theelectronic device different from the first resource, and the methodfurther comprises: identifying at least one of the first function or thesecond function to be executed based on a first indication; andidentifying the third function to be executed based on a secondindication different from the first indication, and one or more of thefirst indication is based on a detected interaction with a firstinterface configured to prevent both of the first function and thesecond function from being selected to be executed; or the secondindication is based on a detected interaction with a second interfaceconfigured to allow the third function to be selectable for execution ata same time that the first function or the second function is selectedfor execution.
 2. The method according to claim 1, wherein the firstfunction is a media transfer protocol (MTP) function, the secondfunction is a picture transfer protocol (PTP) function, and the thirdfunction is an Android Development Bridge (ADB) function.
 3. The methodaccording to claim 1, wherein the plurality of descriptors is receivedfrom the electronic device based on a detection that the electronicdevice is communicatively coupled with the controller by way of aUniversal Serial Bus (USB) interface.
 4. The method according to claim3, wherein the operating command is communicated to the virtual functiondevice corresponding to the at least one function to be executed througha corresponding virtual interface of a plurality of virtual interfacesof the USB interface.
 5. The method according to claim 1, furthercomprising: detecting, by the controller, whether the electronic deviceis communicatively coupled with the electronic device; detecting, by thecontroller, whether the electronic device is in a charging mode or anon-charging mode based on mode information received from the electronicdevice; and communicating a descriptor reception command to theelectronic device based on a determination that the electronic device isin the non-charging mode.
 6. An apparatus, comprising: a processor; anda non-transitory computer readable medium having computer-executableprogram code stored thereon that, when executed by the processor, causesthe apparatus to: process a plurality of descriptors received from anelectronic device communicatively coupled with the apparatus, whereineach descriptor of the plurality of descriptors corresponds to afunction of a plurality of functions of the electronic device, and theprocessing comprises: determining a virtual function devicecorresponding to execution of at least one function of the plurality offunctions based on a successful matching of one or more of the receiveddescriptors with one or more driver files corresponding to at least onefunction of the plurality of functions; and communicate an operatingcommand to the virtual function device corresponding to execution of theat least one function based on an indication that the at least onefunction is to be executed, wherein the operating command causes thevirtual function device corresponding to execution of the at least onefunction to be operated on the electronic device, and two or morefunctions of the plurality of functions associated with differentresources of the electronic device are selectable for execution, a firstfunction and a second function of the plurality of functions areassociated with a first resource of the electronic device, a thirdfunction of the plurality of functions is associated with a secondresource of the electronic device different from the first resource, andthe apparatus is further caused to: identify at least one of the firstfunction or the second function to be executed based on a firstindication; and identify the third function to be executed based on asecond indication different from the first indication, and one or moreof the first indication is based on a detected interaction with a firstinterface configured to prevent both of the first function and thesecond function from being selected to be executed; or the secondindication is based on a detected interaction with a second interfaceconfigured to allow the third function to be selectable for execution ata same time that the first function or the second function is selectedfor execution.
 7. The apparatus according to claim 6, wherein the firstfunction is a media transfer protocol (MTP) function, the secondfunction is a picture transfer protocol (PTP) function, and the thirdfunction is an Android Development Bridge (ADB) function.
 8. Theapparatus according to claim 6, wherein the plurality of descriptors isreceived from the electronic device based on a detection that theelectronic device is communicatively coupled with the apparatus by wayof a Universal Serial Bus (USB) interface.
 9. The apparatus according toclaim 8, wherein the operating command is communicated to the virtualfunction device corresponding to the at least one function to beexecuted through a corresponding virtual interface of a plurality ofvirtual interfaces of the USB interface.
 10. The apparatus according toclaim 6, wherein the apparatus is further caused to: detect whether theelectronic device is communicatively coupled with the electronic device;detect whether the electronic device is in a charging mode or anon-charging mode based on mode information received from the electronicdevice; and communicate a descriptor reception command to the electronicdevice based on a determination that the electronic device is in thenon-charging mode.
 11. A method, comprising: displaying, by anelectronic device, a plurality of functions of the electronic device,the displaying being based on a determination that the electronic deviceis communicatively coupled with a controller, at least one function ofthe plurality of functions corresponds to one virtual interface of aplurality of virtual interfaces, a first function and a second functionof the plurality of functions are associated with a first resource ofthe electronic device, and a third function of the plurality offunctions is associated with a second resource of the electronic devicedifferent from the first resource; communicating a plurality ofdescriptors to the controller, wherein each descriptor of the pluralityof descriptors corresponds to a function of the plurality of functionsof the electronic device; identifying at least one of the first functionor the second function to be executed based on a first indication; andidentifying the third function to be executed based on a secondindication different from the first indication, wherein one or more ofthe first indication is based on a detected interaction with a firstinterface configured to prevent both of the first function and thesecond function from being selected to be executed, or the secondindication is based on a detected interaction with a second interfaceconfigured to allow the third function to be selectable for execution ata same time that the first function or the second function is selectedfor execution.
 12. The method according to claim 11, wherein the firstfunction is a media transfer protocol (MTP) function, the secondfunction is a picture transfer protocol (PTP) function, and the thirdfunction is an Android Development Bridge (ADB) function.